package com.hc;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Calendar;

public class BeanApplication {
    @Test
    public void f1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        User user = (User) context.getBean("user");
        UserController controller = (UserController) context.getBean("userController");
        controller.save(user);
        Student student = (Student) context.getBean("student");
        student.say();
        Calendar calendar1 = (Calendar) context.getBean("calendar1");
        System.out.println(calendar1);
        Calendar calendar2 = (Calendar) context.getBean("calendar2");
        System.out.println(calendar2);
        Calendar calendar3 = (Calendar) context.getBean("calendar3");
        System.out.println(calendar3);
    }
}
